import 'package:cbec_app/entity/home/content/content_data.dart';

class WhiteLineModel extends ContentData {
  final int hasPadding;
  final String color;
  final String lineType;
  final String templateType;
  final String uuid;
  final double height;

  WhiteLineModel({
    required this.hasPadding,
    required this.color,
    required this.lineType,
    required this.templateType,
    required this.uuid,
    required this.height,
  }) {
    type = 'white_line'; // 设置 type 属性
  }


    factory WhiteLineModel.fromJson(Map<String, dynamic> json) {
     return WhiteLineModel(
      hasPadding: json['hasPadding'] as int,
      color: json['color'] as String,
      lineType: json['lineType'] as String,
      templateType: json['template_type'] as String,
      uuid: json['uuid'] as String,
      height: (json['height'] as num).toDouble(),
    );
  }

  @override
  WhiteLineModel fromJson(Map<String, dynamic> json) {
    return WhiteLineModel.fromJson(json);
  }

  @override
  Map<String, dynamic> toJson() {
    return {
      'hasPadding': hasPadding,
      'color': color,
      'lineType': lineType,
      'template_type': templateType,
      'uuid': uuid,
      'height': height,
      'type': type, // 包括 type 属性
    };
  }
}
